#include "Arrow.h"

Arrow::Arrow(void){
	this->Init(Vector3D(), 30, 5);
	this->InitSprite(1);
	this->SetSprite(0, "images/Enemy/Minion/Range/Arrow.tga");

	this->SetSpeed(250.0f);
	this->SetOnGround(true);

	countdownTimer.StartTimer(0, 0, 3, 0);
}

Arrow::~Arrow(void){
}

bool Arrow::UpdateObject(Vector3D offset, float elapsed){
	Object::UpdateObject(offset, elapsed);

	countdownTimer.UpdateTimer();
	
	if(this->GetDirection().x == 1){
		this->invertImage = true;
	}else if(this->GetDirection().x == -1){
		this->invertImage = false;
	}

	this->SetPosition(this->GetPosition() + this->GetDirection() * this->GetSpeed() * elapsed);

	if(countdownTimer.CheckIfTimerEnd())
		return true;

	return false;
}